public class test3 {

    public static boolean isPrime(int n) {
        if (n <= 1) {
            return false;
        }
        if (n <= 3) {
            return true;
        }
        if (n % 2 == 0 || n % 3 == 0) {
            return false;
        }
        for (int i = 5; i * i <= n; i += 6) {
            if (n % i == 0 || n % (i + 2) == 0) {
                return false;
            }
        }
        return true;
    }

    public static void printPrimes(int start, int end) {
        int count = 0;
        for (int num = start; num <= end; num++) {
            if (isPrime(num)) {
                System.out.print(num + " ");
                count++;
                if (count % 5 == 0) {
                    System.out.println(); // 换行
                }
            }
        }
    }

    public static void main(String[] args) {
        if (args.length != 2) {
            System.out.println("Usage: java PrimePrinter <start> <end>");
            System.exit(1);
        }

        int start = Integer.parseInt(args[0]);
        int end = Integer.parseInt(args[1]);

        printPrimes(start, end);
    }
}